Skip to content

eth: add debug_syncTarget API #32126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

nthumann
Copy link
Contributor

@nthumann nthumann commented Jul 1, 2025

closes #31375

Usage:

# set to an old target
> debug.syncTarget(eth.getBlockByNumber('latest').hash)
Error: sync target is already known in the chain
        at web3.js:6352:9(39)
        at send (web3.js:5116:62(29))
        at <eval>:1:17(7)


# success set a sync target
> debug.syncTarget( '0xb08a431304065baacc343026263f3ad5c7cdfafe05bdc1b8cec2be923951f8f0' )
null

# with a non-exist target
> debug.syncTarget( '0xb08a431304065baacc343026263f3ad5c7cdfafe05bdc1b8cec2be923951f8f1' )
Error: failed to retrieve header for target 0xb08a431304065baacc343026263f3ad5c7cdfafe05bdc1b8cec2be923951f8f1: failed to fetch sync target
        at web3.js:6352:9(39)
        at send (web3.js:5116:62(29))
        at <eval>:1:17(3)

@nthumann nthumann requested a review from rjl493456442 as a code owner July 1, 2025 07:20
}

dl := api.eth.Downloader()
header, err := dl.GetHeader(target)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we want to retry a bit if this fails.

@jwasinger
Copy link
Contributor

Duplicate of #31665 , and it seems not quite correct. I'm going to fix up the linked PR and close this. Thanks anyways for trying to contribute.

@jwasinger jwasinger closed this Jul 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add --synctarget to js console
2 participants